﻿using System;
using System.Runtime.InteropServices;

using ULONG = System.UInt32;

namespace ActiveDirectoryUtilities.CommonLibrary.Unsafe
{
	static public class Schedule
	{
		/// <summary>
		/// schedule as understood by NT5
		/// </summary>
		public const uint SCHEDULE_INTERVAL = 0;
		/// <summary>
		/// bandwidth as understood by NT5
		/// </summary>
		public const uint SCHEDULE_BANDWIDTH = 1;
		/// <summary>
		/// priority as understood by NT5
		/// </summary>
		public const uint SCHEDULE_PRIORITY = 2;

		/// <summary>
		/// Each schedule blob begins with n array of schedule headers that
		/// specify the number and type of schedules contained in the blob.
		/// </summary>
		public struct SCHEDULE_HEADER
		{
			/// <summary>
			/// one of the SCHEDULE_ ordinals
			/// </summary>
			public ULONG Type;
			/// <summary>
			/// offset from start of schedule structure
			/// </summary>
			public ULONG Offset;
		}

		public struct SCHEDULE
		{
			/// <summary>
			/// inclusive size in bytes
			/// </summary>
			public ULONG Size;
			public ULONG Bandwidth;
			public ULONG NumberOfSchedules;
			public SCHEDULE_HEADER[] Schedules;
		}

		public const uint SCHEDULE_DATA_ENTRIES = (7 * 24);
	}
}